package com.palfund.butterknife.base;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * @author noone on 2017/11/6.
 *         真正的速度是看不见的 !
 *         Today is today , we will go !
 */

public abstract class BaseFragment extends Fragment {

    private Unbinder mBind;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
            savedInstanceState) {
        View view = inflater.inflate(getContentViewId(), container, false);
        // 绑定Fragment
        mBind = ButterKnife.bind(this, view);
        return view;
    }

    protected abstract int getContentViewId();

    @Override
    public void onDestroy() {
        super.onDestroy();
        mBind.unbind();
    }
}
